﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lenovo.CFI.Common
{
    public class IdeaReview
    {
        #region ctor

        public IdeaReview()
        {
        }

        public IdeaReview(int topicID, int ideaID)
        {
            this.topicID = topicID;
            this.ideaID = ideaID;
        }

        public IdeaReview(int id, int topicID, int ideaID)
        {
            this.id = id;
            this.topicID = topicID;
            this.ideaID = ideaID;
        }

        #endregion


        #region fields

        private int id;
        private int topicID;
        private int ideaID;

        private DateTime? reviewTime;
        private int reviewPeriod;

        private bool? ownerConfirmed;
        private string ownerConfirmComment;

        private string reviewRecord;
        private IdeaReviewStatus reviewStatus = IdeaReviewStatus.Waiting;
        private string reviewSummary;
        private decimal reviewScore;
        private decimal reviewScoreC;
        private decimal reviewScoreB;
        private decimal reviewScoreT;
        private string reviewType;
        private bool? reviewIP;

        private string dcOwner;
        private SuggestionStatus dcSuggestStatus = SuggestionStatus.None;
        private string ipOwner;
        private SuggestionStatus ipSuggestStatus = SuggestionStatus.None;

        private string nextAction;
        private string nextActionPrev;
        private string nextActionBu;
        private bool? nextIP;

        private int? award;
        private string awardComment;

        private string actionExecutor;
        private ExecutionStatus actionStatus = ExecutionStatus.None;
        private string projectName;
        private DateTime? projectTime;
        private string otherBuNextAction;
        private string actionComment;

        private string ipExecutor;
        private ExecutionStatus ipStatus = ExecutionStatus.None;
        private string ipNo;
        private string ipComment;

        #endregion


        #region properties

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        /// <summary>
        /// 评审对应的TopicID
        /// </summary>
        public int TopicID
        {
            get { return topicID; }
            set { topicID = value; }
        }

        /// <summary>
        /// 评审的IdeaID
        /// </summary>
        public int IdeaID
        {
            get { return ideaID; }
            set { ideaID = value; }
        }


        /// <summary>
        /// 评审开始时间 -- NULL表示实际不参加评审会议
        /// </summary>
        public DateTime? ReviewTime
        {
            get { return reviewTime; }
            set { reviewTime = value; }
        }

        /// <summary>
        /// 评审时间长度（分钟） -- 0表示实际不参加评审会议
        /// </summary>
        public int ReviewPeriod
        {
            get { return reviewPeriod; }
            set { reviewPeriod = value; }
        }



        /// <summary>
        /// Owner是否已经确认评审时间 -- NULL表示未处理
        /// </summary>
        public bool? OwnerConfirmed
        {
            get { return ownerConfirmed; }
            set { ownerConfirmed = value; }
        }

        public string OwnerConfirmComment
        {
            get { return ownerConfirmComment; }
            set { ownerConfirmComment = value; }
        }


        /// <summary>
        /// 评审时的记录
        /// </summary>
        public string ReviewRecord
        {
            get { return reviewRecord; }
            set { reviewRecord = value; }
        }

        /// <summary>
        /// 评审时的状态，1，默认，未评审，2，正在进行，3，已评审
        /// </summary>
        public IdeaReviewStatus ReviewStatus
        {
            get { return reviewStatus; }
            set { reviewStatus = value; }
        }

        /// <summary>
        /// 评审汇总
        /// </summary>
        public string ReviewSummary
        {
            get { return reviewSummary; }
            set { reviewSummary = value; }
        }

        /// <summary>
        /// 评审最终得分
        /// </summary>
        public decimal ReviewScore
        {
            get { return reviewScore; }
            set { reviewScore = value; }
        }

        /// <summary>
        /// 评审最终得分
        /// </summary>
        public decimal ReviewScoreC
        {
            get { return reviewScoreC; }
            set { reviewScoreC = value; }
        }

        /// <summary>
        /// 评审最终得分
        /// </summary>
        public decimal ReviewScoreB
        {
            get { return reviewScoreB; }
            set { reviewScoreB = value; }
        }

        /// <summary>
        /// 评审最终得分
        /// </summary>
        public decimal ReviewScoreT
        {
            get { return reviewScoreT; }
            set { reviewScoreT = value; }
        }

        /// <summary>
        /// 评审汇总的类型
        /// </summary>
        public string ReviewType
        {
            get { return reviewType; }
            set { reviewType = value; }
        }

        /// <summary>
        /// 评审汇总的是否IP
        /// </summary>
        public bool? ReviewIP
        {
            get { return reviewIP; }
            set { reviewIP = value; }
        }



        /// <summary>
        /// Suggestion的DC负责人，根据ReviewType确定
        /// </summary>
        public string DcOwner
        {
            get { return dcOwner; }
            set { dcOwner = value; }
        }

        /// <summary>
        /// Suggestion的DC负责人
        /// </summary>
        public SuggestionStatus DcConfirmed
        {
            get { return dcSuggestStatus; }
            set { dcSuggestStatus = value; }
        }

        /// <summary>
        /// Suggestion的IP负责人，根据Topic确定
        /// </summary>
        public string IPOwner
        {
            get { return ipOwner; }
            set { ipOwner = value; }
        }

        /// <summary>
        /// Suggestion的IP负责人
        /// </summary>
        public SuggestionStatus IPConfirmed
        {
            get { return ipSuggestStatus; }
            set { ipSuggestStatus = value; }
        }


        /// <summary>
        /// DC最终确定的Action
        /// </summary>
        public string NextAction
        {
            get { return nextAction; }
            set { nextAction = value; }
        }

        /// <summary>
        /// DC上一次确定的Action -- 用于辅助DC更改Action
        /// </summary>
        public string NextActionPrev
        {
            get { return nextActionPrev; }
            set { nextActionPrev = value; }
        }

        /// <summary>
        /// Action为OtherBU时对应的BU
        /// </summary>
        public string NextActionBu
        {
            get { return nextActionBu; }
            set { nextActionBu = value; }
        }

        /// <summary>
        /// IP最终确定的是否IP，NULL表示未处理
        /// </summary>
        public bool? NextIP
        {
            get { return nextIP; }
            set { nextIP = value; }
        }



        /// <summary>
        /// 是否获奖和获奖等级
        /// </summary>
        public int? Award
        {
            get { return award; }
            set { award = value; }
        }

        public string AwardComment
        {
            get { return awardComment; }
            set { awardComment = value; }
        }


        /// <summary>
        /// Action对应的执行人
        /// </summary>
        public string ActionExecutor
        {
            get { return actionExecutor; }
            set { actionExecutor = value; }
        }

        /// <summary>
        /// Action的执行状态
        /// </summary>
        public ExecutionStatus ActionStatus
        {
            get { return actionStatus; }
            set { actionStatus = value; }
        }

        public string ActionStatusText
        {
            get { return Idea.GetExecutionStatus(this.actionStatus); }
        }

        /// <summary>
        /// Action对应的项目的名称
        /// </summary>
        public string ProjectName
        {
            get { return projectName; }
            set { projectName = value; }
        }

        /// <summary>
        /// Action对应的项目导入或启动时间
        /// </summary>
        public DateTime? ProjectTime
        {
            get { return projectTime; }
            set { projectTime = value; }
        }

        public string OtherBuNextAction
        {
            get { return otherBuNextAction; }
            set { otherBuNextAction = value; }
        }

        /// <summary>
        /// Action对应的备注
        /// </summary>
        public string ActionComment
        {
            get { return actionComment; }
            set { actionComment = value; }
        }



        /// <summary>
        /// IP对应的执行人
        /// </summary>
        public string IpExecutor
        {
            get { return ipExecutor; }
            set { ipExecutor = value; }
        }

        /// <summary>
        /// IP的执行状态
        /// </summary>
        public ExecutionStatus IpStatus
        {
            get { return ipStatus; }
            set { ipStatus = value; }
        }

        public string IpStatusText
        {
            get { return Idea.GetExecutionStatus(this.ipStatus); }
        }

        /// <summary>
        /// IP的NO
        /// </summary>
        public string IpNo
        {
            get { return ipNo; }
            set { ipNo = value; }
        }

        /// <summary>
        /// IP对应的备注
        /// </summary>
        public string IpComment
        {
            get { return ipComment; }
            set { ipComment = value; }
        }        

        #endregion


        #region Details

        private List<IdeaReviewDetail> details;

        /// <summary>
        /// 评审明细
        /// </summary>
        public List<IdeaReviewDetail> Details
        {
            get
            {
                if (this.details == null)
                    this.details = new List<IdeaReviewDetail>();

                return details;
            }
        }

        #endregion
    }
    public enum IdeaReviewStatus
    {
        /// <summary>
        /// 未进行
        /// </summary>
        Waiting = 1,

        /// <summary>
        /// 正在进行
        /// </summary>
        OnGoing = 2,

        /// <summary>
        /// 已完成
        /// </summary>
        Finished = 3,

        /// <summary>
        /// Summary
        /// </summary>
        Summary = 4,
    }

}
